static unsigned int bus_freq;
static u32 bus_cycle; /* length of one bus cycle in pico-seconds */
static u32 bus_scale; /* scaling factor convert ns to bus cycles */
-u64 cpu_freq;
/*
* The timer chip is already set up at HZ interrupts per second here,
result / (1000000/HZ),
result % (1000000/HZ));
- cpu_freq = (u64)(((t2-t1)/LOOPS)*HZ);
+ /*
+ * KAF: Moved this to time.c where it's calculated relative to the TSC.
+ * Therefore works on machines with no local APIC.
+ */
+ /*cpu_freq = (u64)(((t2-t1)/LOOPS)*HZ);*/
/* set up multipliers for accurate timer code */
bus_freq = result*HZ;
#endif
initialize_keytable(); /* call back handling for key codes */
- disable_pit(); /* not needed anymore */
+ if ( cpu_has_apic )
+ disable_pit();
+ else if ( smp_num_cpus != 1 )
+ panic("We really need local APICs on SMP machines!");
+
ac_timer_init(); /* init accurate timers */
init_xeno_time(); /* initialise the time */
schedulers_start(); /* start scheduler for each CPU */
static unsigned int rdtsc_bitshift; /* Which 32 bits of TSC do we use? */
static unsigned long init_cmos_time; /* RTC time when system time == 0 */
-static u64 cpu_freqs[3]; /* Slow/correct/fast CPU freqs */
+static u64 cpu_freqs[3]; /* Slow/correct/fast CPU frequencies */
+static u64 cpu_freq; /* Currently-selected CPU frequency */
static u32 st_scale_f; /* Cycles -> ns, fractional part */
static u32 st_scale_i; /* Cycles -> ns, integer part */
static struct ac_timer update_timer; /* Periodic 'time update' function */
}
#endif
do_timer(regs);
+ do_ac_timer();
}
/*
ticks_per_usec = ticks_per_frac / (1000000/CALIBRATE_FRAC);
cpu_khz = ticks_per_frac / (1000/CALIBRATE_FRAC);
+ cpu_freq = (u64)ticks_per_frac * (u64)CALIBRATE_FRAC;
+
printk("Detected %lu.%03lu MHz processor.\n",
cpu_khz / 1000, cpu_khz % 1000);
*/
extern int init_xeno_time();
-/*
- * Cycle Counter Time (defined in asm/time.h)
- */
-
-
-extern u64 cpu_freq;
/*
* System Time